// Copyright (C) joyinter
// All rights reserved.
// 
// Author : Jiang Li
// Date   : 2004-12-16

#include "stdafx.h"
#include "async_updatever.h"
#include "db_utility.h"
#include "svr_showinfo.h"

namespace JoyServer
{

// class CJoyAsyncUpdateVer

void CJoyAsyncUpdateVer::OnExecute()
{
    // open session from server data source.
    CJoyDbSession servSess;
    if(!JoyOpenDbSession(m_server, servSess, m_server->m_dbServer))
    {
        return;
    }

    // create and open command
    CJoyDbCommand rsAttrib;
    if(!JoyInvokeCommand(m_server, servSess, rsAttrib,
        L"select_server_attribute", m_server->m_serverId))
    {
        return;
    }
    if(!HasMoreRow(rsAttrib.MoveNext()))
    {
        m_server->m_showInfo->QueueTimeColorText(InfoColor_Error,
            "failed update version. read server configurations failed. not find any record.\n");
        return;
    }
    m_server->LoadClientVersions(rsAttrib);
}

} // namespace JoyServer